package com.vvv.myapiclientsdk.model.response;

import com.fasterxml.jackson.annotation.JsonAnyGetter;
import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author: QiMu
 * @Date: 2023/08/17 09:14:26
 * @Version: 1.0
 * @Description: 通用返回类
 */
@Data
public abstract class AbstractResponse implements Serializable {

    /**
     * 状态码
     */
    private Integer code;

    /**
     * 自定义响应参数
     */
    private Map<String, Object> customizedParams = new HashMap<>();

    /**
     * get customized key value pairs
     * @return
     */
    @JsonAnyGetter
    public Map<String, Object> getCustomizedParams() {
        return customizedParams;
    }

    /**
     * set customized key value pairs
     * @param key
     * @param value
     */
    public void set(String key, Object value) {
        this.customizedParams.put(key, value);
    }
}